
#****************************************************************************************************************************************************************
#
# (C)- Ankit Sinha , August, 2013
#
#****************************************************************************************************************************************************************
# You may put any variables that you wish to maintain at the module level:

got_award = 0	# variable to store whether award was received in the last round or not

def hunt_choices(round_number, current_food, current_reputation, m,  player_reputations):
    # The main routine that plays each individual round.
	p=len(player_reputations);	
	hunt_decisions=['s']*p;		#'s' for slack
	if (round_number<10):
		for x in range (p):			
			if (x%2==0):
				hunt_decisions[x]='h';
	elif (round_number==10):
		for x in range (p):
			if (player_reputations[x]>0.15 or player_reputations[x]< 0.85):
				hunt_decisions[x]='h';	
	elif (round_number>10 and round_number<120):
		for x in range (p):
			if (player_reputations[x]<(0.25-(float(round_number)/2000))):
				hunt_decisions[x]='s';
			elif (player_reputations[x]>(0.75)):
				hunt_decisions[x]='s';
			else:
				if ((current_reputation< (player_reputations[x]-0.20)) or (current_reputation> (player_reputations[x]+0.20))):
					hunt_decisions[x]='s';
				else:
					hunt_decisions[x]='h'; #'h' for hunt
	elif (round_number>120):
		if (current_food>25*(p-1) and current_reputation<0.40):#hunt to increase reputation
			for x in range (p):
				if (player_reputations[x]<(0.15-(float(round_number)/2000))):#dont hunt if reputation too low
					hunt_decisions[x]='s';
				elif (player_reputations[x]>(0.75)):			#dont hunt if reputation too high
					hunt_decisions[x]='s';
				else:
					hunt_decisions[x]='h';
		else:	
			for x in range (p):
				if (player_reputations[x]<(0.25)):
					hunt_decisions[x]='s1';
				elif (player_reputations[x]>(0.70+(float(round_number)/2000))):
					hunt_decisions[x]='s2';
				else:
					if ((current_reputation< (player_reputations[x]-0.20)) or (current_reputation> (player_reputations[x]+0.20))):#dont hunt if 														#reputation differs by 0.20, the other player will not tend to hunt.
						hunt_decisions[x]='s3';
						print hunt_decisions;
					elif (got_award==1):		#dont hunt if got award in the last turn
						hunt_decisions[x]='s4';	
						print hunt_decisions;				
					elif (m<p*(p-1)/3):		#if threshold is low, then cooperate
						hunt_decisions[x]='h1';
						print hunt_decisions;
					else:	
						hunt_decisions[x]='h2';
						print hunt_decisions;	

    	return hunt_decisions;

def hunt_outcomes(food_earnings):
	pass

def round_end(award, m, number_hunters):
	if (number_hunters>=m):
		got_award=1;
	else:
		got_award=0;
    

print hunt_choices(125,300,0.6,34,[0.0,0.3,0.6,0.75,1.0]);
